---
title: "SQL-003: Period date query"
summary: Retrieve latest issued policy period dates for a list of policies.
status: draft
owner: SAIF Corporation
last_reviewed: 2026-08-21
library: SAIF.Business.View.Policy
reference_type: embedded
---

# SQL-003 Period date query

Retrieve latest issued policy period dates for a list of policies.

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-003 |
| **Operation type** | Read |
| **Execution method** | StringBuilder-assembled |
| **Database** | Oracle |
| **Schema** | `[unqualified]**` |
| **Command type** | Text |
| **Business object** | `clsAssociationTypeCode` |
| **Criteria property** | `PeriodDateSQL` (private const) |
| **Lifecycle method** | `GetPeriodDates` (static helper) |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [POLICY_PERIOD_ALL](../database-tables.md#policy_period_all) | SELECT / JOIN | `policy_num`, `policy_period_eff_date`, `cancel_date`, `policy_period_exp_date` |
| [ENDORSEMENT](../database-tables.md#endorsement) | SELECT / JOIN | `policy_num`, `policy_period_eff_date`, `endorse_code`, `printed_date` |
| [POLICY_PERIOD_NON_WCIS](../database-tables.md#policy_period_non_wcis) | SELECT / JOIN | `policy_num`, `policy_period_eff_date`, `policy_period_status_code` |

## Sample SQL

```sql
SELECT
  pp.policy_num AS PolicyNumber,
  pp.policy_period_eff_date AS EffectiveDate,
  NVL(pp.cancel_date, pp.policy_period_exp_date) AS ExpirationDate
FROM policy_period_all pp
JOIN (
  -- get the most recent issued period per policy
  SELECT
    pp.policy_num,
    MAX(pp.policy_period_eff_date) AS policy_period_eff_date
  FROM policy_period_all pp
  JOIN (
    -- get all issued periods for all policies
    SELECT
      policy_period_eff_date,
      policy_num
    FROM endorsement
    WHERE endorse_code = 'P401'
      AND printed_date IS NOT NULL
    UNION
    SELECT
      policy_period_eff_date,
      policy_num
    FROM policy_period_non_wcis
    WHERE policy_period_status_code = 'E'
  ) issued_periods
    ON pp.policy_num = issued_periods.policy_num
   AND pp.policy_period_eff_date = issued_periods.policy_period_eff_date
  WHERE pp.policy_period_eff_date <> NVL(cancel_date, policy_period_exp_date)
  GROUP BY pp.policy_num
) max_periods
  ON pp.policy_num = max_periods.policy_num
 AND pp.policy_period_eff_date = max_periods.policy_period_eff_date
WHERE pp.policy_num IN ({0})
```


## Operations and processes
- [Retrieve policy associations](../operations-processes.md)

## Business rules
- [BR-VP-024: Default association dates](../business-rules.md#br-vp-024-default-association-dates)

## Sources
- `SAIF.Business.View.Policy/Associations/clsAssociationTypeCode.vb`
